<!DOCTYPE html>
<html class="iframe-h" xmlns:th="http://www.w3.org/1999/xhtml">

	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>教师管理</title>
		<link rel="stylesheet" type="text/css" th:href="@{/admin/layui/css/layui.css}"
			href="../../static/admin/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" th:href="@{/admin/css/admin.css}"
			href="../../static/admin/css/admin.css" />
	</head>

	<body>
		<div class="wrap-container clearfix">
			<div class="column-content-detail">
				<form class="layui-form" action="">
					<div class="layui-form-item">
						<div class="layui-inline tool-btn">
							<!-- 老师添加 -->
							<button class="layui-btn layui-btn-small layui-btn-normal addBtn" data-url="teacher-add"><i
									class="layui-icon">&#xe654;</i></button>
							<button class="layui-btn layui-btn-small layui-btn-danger delBtn"
								data-url="article-add.html"><i class="layui-icon">&#xe640;</i></button>
						</div>
						<div class="layui-inline">
							<input type="text" name="user_name" placeholder="请输入老师的名字"
								th:value="${user} eq null or ${user} eq '' or ${user} eq 'null' ? '' :${user}"
								autocomplete="off" class="layui-input" />
						</div>
						<div class="layui-inline">
							<select name="state" lay-filter="status">
								<option value="">选择老师状态</option>
								<option value=" "
									th:selected="${state} eq null or ${state} eq ' ' ? 'selected' : 'no' ">全部</option>
								<option value="1" th:selected="${state} eq 1 ? 'selected' : 'no' ">在职</option>
								<option value="2" th:selected="${state} eq 2 ? 'selected' : 'no' ">离职</option>
							</select>
						</div>
						<button class="layui-btn layui-btn-normal" lay-submit="search">搜索</button>
					</div>
				</form>
				<div class="layui-form" id="table-list">
					<table class="layui-table" lay-even lay-skin="nob" id="table-teacher">
						<colgroup>
							<col width="50">
							<col class="hidden-xs" width="50">
							<col class="hidden-xs" width="100">
							<col>
							<col class="hidden-xs" width="150">
							<col class="hidden-xs" width="150">
							<col width="80">
							<col width="150">
						</colgroup>
						<thead>
							<tr>
								<th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
								<!-- ID通常不需要知道 -->
								<th class="hidden-xs" style="display: none;">ID</th>
								<!-- <th class="hidden-xs">排序</th> -->
								<th>账号名</th>
								<th>老师姓名</th>
								<th class="">性别</th>
								<th class="">电话号码</th>
								<!-- <th class="">身份证号</th> -->
								<th class="">所属机构</th>
								<th>身份</th>
								<th>状态</th>
								<th>修改</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<tr th:each="list:${pageObject.records}">
								<td><input type="checkbox" name="" lay-skin="primary" data-id="1"></td>
								<td class="hidden-xs" style="display: none;">[[${list.id}]]</td>
								<!-- <td class="hidden-xs"><input type="text" name="title" autocomplete="off" class="layui-input" value="0" data-id="1"></td> -->
								<!-- 账号名 -->
								<td>[[${list.account}]]</td>
								<!-- 老师姓名 -->
								<td>[[${list.user_name}]]</td>
								<!-- 性别 -->
								<td th:text="${list.sex} eq 1 ? '男' : '女'"></td>

								<!-- 电话号码 -->
								<td class="">[[${list.phone}]]</td>
								<!-- 身份证 -->
								<!-- <td class="">ooooxxxx000</td> -->

								<!-- 所属机构 -->
								<td class="">[[${list.setup}]]</td>
								<td>[[${list.identity}]]</td>
								<!-- 状态 -->
								<td>
									<button
										th:class="${list.state} eq 1 ? 'layui-btn layui-btn-small layui-btn-normal' : 'layui-btn layui-btn-small layui-btn-warm' "
										th:text="${list.state} eq 1 ? '在职' : '离职' " name="button_state"
										th:data-id="${list.id}" th:data-state="${list.state} eq 1 ? 2 : 1"
										th:data-name="${list.user_name}"></button>
								</td>
								<!-- 详情 -->
								<td class="">
									<button class="layui-btn layui-btn-small layui-btn-normal detailsBtn"
										th:data-id="${list.id}"
										th:attrappend="data-url=${'teacher-modify/id/' +{list.id}}"><i
											class="layui-icon">&#xe642;</i></button>
								</td>
								<!-- 操作 -->
								<td>
									<div class="layui-inline">
										<!-- <button class="layui-btn layui-btn-small layui-btn-normal go-btn" data-id="1" data-url="article-detail.html"><i class="layui-icon">&#xe642;</i></button> -->
										<button class="layui-btn layui-btn-small layui-btn-danger del-btn"
											th:data-id="${list.id}" th:data-url="${'/doUserDelete/id/' +list.id }"><i
												class="layui-icon">&#xe640;</i></button>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<div class="page-wrap">
						<ul class="pagination">
							<li class="disabled"><span>«</span></li>
							<li th:each="pages:${pageObject.pageList}"
								th:class="${pageObject.pageCurrent} eq ${pages} ? 'active' : 'page-button'">
								<span class="page" th:if="${pageObject.pageCurrent} eq ${pages}">[[${pages}]]</span>
								<a class="page" th:if="${pageObject.pageCurrent} neq ${pages}"
									th:attrappend="href=${'teacher-list?user_name=' + user_name+'&state='+state+'&pageCurrent='+pages}">[[${pages}]]</a>
							</li>
							<li>
								<a href="#">»</a>
							</li>
						</ul>
						<ul>
							<li>共[[${pageObject.pageCount}]]页</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<script src="../../static/admin/layui/layui.js" th:src="@{/admin/layui/layui.js}" type="text/javascript"
			charset="utf-8"></script>
		<script src="../../static/admin/js/common.js" th:src="@{/admin/js/common.js}" type="text/javascript"
			charset="utf-8"></script>
		<script src="../../static/admin/js/jquery.js" th:src="@{/admin/js/jquery.js}" type="text/javascript"
			charset="utf-8"></script>
		<script src="../../static/admin/js/jquery.min.js" th:src="@{/admin/js/jquery.min.js}" type="text/javascript"
			charset="utf-8"></script>
	</body>

	<script>
		//就职状态修改的
		$("button[name='button_state']").on("click", function() {
			let name = $(this).attr("data-name");
			let stateConfirm = confirm("请问您是否要修改: "+name+"的就职状态");
			
			if(stateConfirm == true){
				let id = $(this).attr("data-id");
				let state = $(this).attr("data-state");
				let params = {
					id: id,
					state: state
				}
				$.get("/doStateChange", params, function() {
					window.location.reload();
				});
			}
			
		});
		
		//删除成员
	</script>

</html>
